//
//  AboutVC.m
//  Ginix
//
//  Created by ff on 2025/3/10.
//

#import "AboutVC.h"
#import "PrivacyOfUserDetailsVC.h"
@interface AboutVC ()
@property (nonatomic,strong) UIImageView * iconView;
@property (nonatomic,strong) UILabel * infoLabel;
@property (nonatomic,strong) YYLabel * agreeLabel;
@property (nonatomic,strong) UILabel * nameLabel;
@end

@implementation AboutVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setSubViewLayout];
}

-(void)setSubViewLayout{
    
    self.title = @"关于我们";
    [self.view addSubview:self.iconView];
    [_iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_offset(CGSizeMake(108 * FMScaleX, 108 * FMScaleX));
        make.centerX.equalTo(@0);
        make.top.mas_offset(NavHeight + 50 * FMScaleX);
    }];
    [self.view addSubview:self.infoLabel];
    [_infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(@0);
        make.top.equalTo(self.iconView.mas_bottom).offset(30 * FMScaleX);
    }];
    [self.view addSubview:self.agreeLabel];
    [_agreeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(@0);
        make.bottom.mas_offset(kSafeAreaHeight - 80 * FMScaleX);
    }];
    [self.view addSubview:self.nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(@0);
        make.bottom.equalTo(self.agreeLabel.mas_top).offset(-20 * FMScaleX);

    }];
}

-(UIImageView *)iconView{
    
    if (!_iconView) {
        _iconView = [[UIImageView alloc]init];
        _iconView.image = [UIImage imageNamed:@"Me_About_icon"];
    }
    return _iconView;
}
-(UILabel *)infoLabel{
    
    if (!_infoLabel) {
        _infoLabel = [[UILabel alloc]init];
        _infoLabel.font = Regular(13);
        _infoLabel.textColor = RDRGB(0x714933);
        _infoLabel.text = @"当前版本1.0.0";
    }
    return _infoLabel;
}

-(YYLabel *)agreeLabel{
    if (!_agreeLabel) {
        _agreeLabel = [[YYLabel alloc]init];
        _agreeLabel.textColor = RDRGB(0x714933);
        NSMutableAttributedString * attri = [[NSMutableAttributedString alloc]initWithString:@"隐私政策   |   用户协议" attributes:@{NSForegroundColorAttributeName:RDRGB(0x714933)}];
        @WeakObj(self)
        [attri yy_setTextHighlightRange:[attri.string rangeOfString:@"用户协议"] color:RDRGB(0xB6904A) backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
           @StrongObj(self)
             PrivacyOfUserDetailsVC * vc = [[PrivacyOfUserDetailsVC alloc]init];
             vc.type = userType;
             [self.navigationController pushViewController:vc animated:YES];
        }];
        [attri yy_setTextHighlightRange:[attri.string rangeOfString:@"隐私政策"] color:RDRGB(0xB6904A) backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
            @StrongObj(self)
            PrivacyOfUserDetailsVC * vc = [[PrivacyOfUserDetailsVC alloc]init];
            vc.type = privacyType;
            [self.navigationController pushViewController:vc animated:YES];
        }];
        _agreeLabel.attributedText = attri;
        _agreeLabel.font = Regular(14);

    }
    return _agreeLabel;
}

-(UILabel *)nameLabel{
    
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.textColor = RDRGB(0x714933);
        _nameLabel.font = Regular(13);
        _nameLabel.text = @"©2021  浙江华在信息技术有限公司";
    }
    return _nameLabel;
}
@end
